﻿/*
* Copyright 2010 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using Ngilead.Test.Models;
using System.Text;
using Ngilead.Test.Models.Stateless;
using System.Runtime.Serialization;

namespace Ngilead.Test
{
    /// <summary>
    /// Wrapping (non persistent) class containing persistent classes. Must be cloned and merged as a regular persistent bean.
    /// </summary>
    [DataContract]
    [Serializable]
    [KnownType(typeof(WrappingClass))]
    [KnownType(typeof(WrappingClass.enumErrorCode))]
    public class WrappingClass
    {
        #region Enum

        /// <summary>
        /// ErrorCode enumeration definition
        /// </summary>
        public enum enumErrorCode
        {
            /// <summary>OK</summary>
            ok,
            /// <summary>Warning</summary>
            warning,
            /// <summary>Error</summary>
            error
        };

        #endregion

        #region Private

        /// <summary>
        /// The associated user
        /// </summary>
        protected User _user;

        /// <summary>
        /// The associated message list
        /// </summary>
        protected IList<Message> _messageList;

        /// <summary>
        /// The error code
        /// </summary>
        protected enumErrorCode _errorCode;

        #endregion

        #region Public

        /// <summary>
        /// User
        /// </summary>
        [DataMember]
        public virtual User User
        {
            get { return _user; }
            set { _user = value; }
        }

        /// <summary>
        /// Message List
        /// </summary>
        [DataMember]
        public virtual IList<Message> MessageList
        {
            //get { return _messageList.ToList<Message>().AsReadOnly(); }
            get { return _messageList; }
            set { _messageList = value; }
        }

        /// <summary>
        /// User
        /// </summary>
        [DataMember]
        public virtual enumErrorCode ErrorCode
        {
            get { return _errorCode; }
            set { _errorCode = value; }
        }

        #endregion
    }
}
